#include "camera.h"

Camera::Camera(){
	this->eye = Vector(-400.0,0.0,150.0);
	//this->eye = Vector(1.0,1.0,0.0);
	this->center = Vector(0.0,0.0,0.0);
	//this->center = Vector(-50.0,90.0,170.0);
	this->alpha=0.0f;
	this->beta=0.0f;
	this->pushed= 0;//0 rien, 1 click droit , 2 click gauche
}

Camera::~Camera(){
}

void Camera::avancer(){
	eye += (center - eye) / Norm(center - eye) * 4;
}

void Camera::reculer(){
	eye -= (center - eye) / Norm(center - eye) * 4;
}

void Camera::decalerD(){
	Vector n = center - eye;
	n[2]=0;
	n /= Norm(n);
	float temp = (float)n[0];
	n[0]=n[1];
	n[1]=-temp;
	eye += n * 4;
	center += n * 4;
}

void Camera::decalerG(){
	Vector n = center - eye;
	n[2]=0;
	n /= Norm(n);
	float temp = (float)n[0];
	n[0]=-n[1];
	n[1]=temp;
	eye += n * 4;
	center += n * 4;
}

Vector Camera::getEye(){
	return this->eye;
}

Vector Camera::getCenter(){
	return this->center;
}

float Camera::getAlpha(){
	return this->alpha;
}

float Camera::getBeta(){
	return this->beta;
}

int Camera::getXMouse(){
	return this->xMouse;
}

int Camera::getYMouse(){
	return this->yMouse;
}

int Camera::getPushed(){
	return this->pushed;
}

void Camera::setEye(Vector v){
	this->eye = v;
}

void Camera::setCenter(Vector v){
	this->center = v;
}

void Camera::setAlpha(float f){
	this->alpha = f;
}

void Camera::setBeta(float f){
	this->beta = f;
}

void Camera::setCoordMouse(int x, int y){
	this->xMouse = x;
	this->yMouse = y;
}

void Camera::setPushed(int p){
	this->pushed = p;
}